texture: Unvirtualize download_surface
authorAlexander Larsson <alexl@redhat.com>
Thu, 24 Sep 2020 13:40:17 +0000 (15:40 +0200)
committerAlexander Larsson <alexl@redhat.com>
Fri, 25 Sep 2020 07:31:43 +0000 (09:31 +0200)
We only have one implementation, so why do all this vfunc work?

gdk/gdktexture.c
gdk/gdktextureprivate.h

index a6db7d5e17b14ae0ed4d18ede1436ad933907107..c28bd9575f4f99a7551c07baa1d94bd9dc9c2595 100644 (file)
@@ -130,28 +130,6 @@ gdk_texture_real_download (GdkTexture         *self,
   GDK_TEXTURE_WARN_NOT_IMPLEMENTED_METHOD (self, download);
 }
 
-static cairo_surface_t *
-gdk_texture_real_download_surface (GdkTexture *texture)
-{
-  cairo_surface_t *surface;
-  cairo_status_t surface_status;
-
-  surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
-                                        texture->width, texture->height);
-
-  surface_status = cairo_surface_status (surface);
-  if (surface_status != CAIRO_STATUS_SUCCESS)
-    g_warning ("%s: surface error: %s", __FUNCTION__,
-               cairo_status_to_string (surface_status));
-
-  gdk_texture_download (texture,
-                        cairo_image_surface_get_data (surface),
-                        cairo_image_surface_get_stride (surface));
-  cairo_surface_mark_dirty (surface);
-
-  return surface;
-}
-
 static void
 gdk_texture_set_property (GObject      *gobject,
                           guint         prop_id,
@@ -216,7 +194,6 @@ gdk_texture_class_init (GdkTextureClass *klass)
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 
   klass->download = gdk_texture_real_download;
-  klass->download_surface = gdk_texture_real_download_surface;
 
   gobject_class->set_property = gdk_texture_set_property;
   gobject_class->get_property = gdk_texture_get_property;
@@ -438,7 +415,23 @@ gdk_texture_get_height (GdkTexture *texture)
 cairo_surface_t *
 gdk_texture_download_surface (GdkTexture *texture)
 {
-  return GDK_TEXTURE_GET_CLASS (texture)->download_surface (texture);
+  cairo_surface_t *surface;
+  cairo_status_t surface_status;
+
+  surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
+                                        texture->width, texture->height);
+
+  surface_status = cairo_surface_status (surface);
+  if (surface_status != CAIRO_STATUS_SUCCESS)
+    g_warning ("%s: surface error: %s", __FUNCTION__,
+               cairo_status_to_string (surface_status));
+
+  gdk_texture_download (texture,
+                        cairo_image_surface_get_data (surface),
+                        cairo_image_surface_get_stride (surface));
+  cairo_surface_mark_dirty (surface);
+
+  return surface;
 }
 
 void
index 07cb5436a33f91af277dbcea532e60a792fe419e..3e2e9f3a4944fad3e02d128bd0cd0d587c7b2257 100644 (file)
@@ -28,7 +28,6 @@ struct _GdkTextureClass {
                                                          const GdkRectangle     *area,
                                                          guchar                 *data,
                                                          gsize                   stride);
-  cairo_surface_t *     (* download_surface)            (GdkTexture             *texture);
 };
 
 gpointer                gdk_texture_new                 (const GdkTextureClass  *klass,